package com.chinasofti.controluser.service.impl;

import java.io.Serializable;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.chinasofti.controlcommon.common.ServerResponse;
import com.chinasofti.controlcommon.domain.entity.SysUser;
import com.chinasofti.controluser.dao.SysUserMapper;
import com.chinasofti.controluser.service.ControlUserService;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@Service
public class ControlUserImpl implements ControlUserService {
	@Autowired
	private SysUserMapper sysUserMapper;
	
	@Override
	public ServerResponse addUser(SysUser user) {
		try{
			 sysUserMapper.insert(user);
		     }
	        catch(Exception exception){
	            log.info("新增用户异常!"+exception.getMessage());
	        }
		return ServerResponse.createBySuccess("新增用户成功");
	}

	@Override
	public ServerResponse updateUser(SysUser user) {
		try{
			 sysUserMapper.updateById(user);
		     }
	        catch(Exception exception){
	            log.info("修改用户异常!"+exception.getMessage());
	        }
		return ServerResponse.createBySuccess("修改用户成功");
	}

	@Override
	public ServerResponse deleteUser(List<String> id) {
		try{
			sysUserMapper.deleteUser(id);
		     }
	        catch(Exception exception){
	            log.info("删除用户异常!"+exception.getMessage());
	        }
		return ServerResponse.createBySuccess("删除用户成功");
	}

}
